﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdBrBrepEdgeTraverser : OdBrTraverser
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdBrBrepEdgeTraverser(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdBrBrepEdgeTraverser_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdBrBrepEdgeTraverser obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdBrBrepEdgeTraverser()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdBrBrepEdgeTraverser(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public OdBrErrorStatus setBrep(OdBrBrep brep)
		{
			OdBrErrorStatus result = (OdBrErrorStatus)GlobalsPINVOKE.OdBrBrepEdgeTraverser_setBrep(this.swigCPtr, OdBrBrep.getCPtr(brep));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrErrorStatus setBrepAndEdge(OdBrEdge edge)
		{
			OdBrErrorStatus result = (OdBrErrorStatus)GlobalsPINVOKE.OdBrBrepEdgeTraverser_setBrepAndEdge(this.swigCPtr, OdBrEdge.getCPtr(edge));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrErrorStatus setEdge(OdBrEdge edge)
		{
			OdBrErrorStatus result = (OdBrErrorStatus)GlobalsPINVOKE.OdBrBrepEdgeTraverser_setEdge(this.swigCPtr, OdBrEdge.getCPtr(edge));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrEdge getEdge()
		{
			OdBrEdge result = new OdBrEdge(GlobalsPINVOKE.OdBrBrepEdgeTraverser_getEdge(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrBrep getBrep()
		{
			OdBrBrep result = new OdBrBrep(GlobalsPINVOKE.OdBrBrepEdgeTraverser_getBrep(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrBrepEdgeTraverser() : this(GlobalsPINVOKE.new_OdBrBrepEdgeTraverser(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
